package journalarray;

import java.util.*;

/**
 * This is interface for ArrayJournal
 *
 * @author Евгений
 */
public interface Journal {

    /**
     * Add record to database
     *
     * @param r record
     */
    void add(Record r);

    /**
     * Add all records from other journal to database
     *
     * @param j journal
     */
    void add(Journal j);

    /**
     * Remove record from database
     *
     * @param r record for remove
     */
    void remove(Record r);

    /**
     * Return record with index
     *
     * @param index index of record
     * @return
     */
    Record get(int index);

    /**
     * Input new record on index (old record is removed)
     *
     * @param index index in database
     * @param record new record
     */
    void set(int index, Record record);

    /**
     * Insert record in database on index
     *
     * @param index index in database
     * @param record record for insert
     */
    void insert(int index, Record record);

    /**
     * Remove record with index
     *
     * @param index index in database
     */
    void remove(int index);

    /**
     * Remove all records from index to index
     *
     * @param fromIndex from index
     * @param toIndex to index
     */
    void remove(int fromIndex, int toIndex);

    /**
     * Remove all records from database
     */
    void removeAll();

    /**
     * Return size of the database or count of records in database
     *
     * @return count of records in database
     */
    int size();

    /**
     * Filter by string
     *
     * @param s filter
     * @return
     */
    Journal filter(String s);

    /**
     * Filter by date
     *
     * @param fromDate begin date
     * @param toDate end date
     * @return
     */
    Journal filter(Date fromDate, Date toDate);

    /**
     * Sort all data in database by Date
     */
    void sortByDate();

    /**
     * Sort all data by Importance and Date
     */
    void sortByImportanceDate();

    /**
     * Sort all data by Importance, Source and Date
     */
    void sortByImportanceSourceDate();

    /**
     * Sort all data in database by source and date
     */
    void sortBySourceDate();

    /**
     * Print all data from database to base input
     */
    void printRecords();
}
